package operation;

import staff.Staff;
import staff.StaffList;
import java.util.Scanner;
public class AddOperation implements IOperation {
    @Override
    public Staff work(StaffList staffList) {
        System.out.println("员工基本信息录入");
        System.out.println("输入编号");
        Scanner sc = new Scanner(System.in);
        Scanner sc1 = new Scanner(System.in);
        int staff_id = sc.nextInt();
        System.out.println("输入姓名");
        String staff_name = sc1.nextLine();
        System.out.println("输入性别");
        String sex = sc1.nextLine();
        System.out.println("输入生日");
        int birth = sc.nextInt();
        System.out.println("输入部门代码");
        int department_id = sc.nextInt();
        System.out.println("输入部门名称");
        String department_name = sc1.nextLine();
        Staff staff = new Staff(staff_id,staff_name,sex,birth,department_id,department_name);
        int size = staffList.usedSize;
        staffList.setStaffs(size,staff);
        staffList.setUsedSize(size+1);
        System.out.println("增加信息成功");
        return staff;
    }
}
